import { useEffect, useState } from "react";

function LoginCallback() {
  const [imgUrl, setImgUrl] = useState("");

  useEffect(() => {
    // 是否登录
    if (QC.Login.check()) {
      // 拿去openid
      QC.Login.getMe((openId: number, accessToken: any) => {
        console.log(openId, accessToken);

        QC.api(
          "get_user_info",
          { params: { unionId: openId } },
          "json",
          "get"
        ).success((res: any) => {
          setImgUrl(res.data.figureurl);
          console.log(res.data);
        });
      });
    }
  }, []);

  <div>
    QQ回调界面
    <img src={imgUrl} alt="" />
  </div>;
}
export default LoginCallback;
